<template>
<div class="box">
<!-- 头部banner -->
<!-- <div class="top">
<van-row gutter="32">
  <van-col span="8"><van-icon name="arrow-left" /></van-col>
  <van-col span="8" class="text">产品详情</van-col>
  <van-col span="8"><van-icon name="ellipsis" /></van-col>
</van-row>
</div>   -->

    <header>
      <button @click="$router.go(-1)" class="back-button">&lt;</button>
      <h1>理财精选</h1>
      <button class="more-button">···</button>
    </header>
<!-- 气泡 -->
<div class="container1">
      <!-- <canvas ref="ballCanvas"></canvas> -->
              <!--气泡浮动效果-->
        <div class="bubbles">
            <div class="bubble"><p >业绩比较基准<span class="percent">2.61%</span></p></div>
            <div class="bubble"><p >单位净值 <span class="percent">1.1916</span> </p></div>
            <div class="bubble"><p>中低风险</p></div>
            <div class="bubble"><p>投资周期七天</p></div>
            <div class="bubble"><p>1万起投</p></div>
            <div class="bubble"><p>自营理财</p></div>
            <div class="bubble"><p>固收产品</p></div>
        </div>
</div>
<!-- 破图 -->
<div class="chart-container">
  <van-tabs v-model:active="active" swipeable>
  <van-tab >
  <template #title>成立以来收益率<van-icon name="question-o" /> </template>
  <van-space  size="1rem">
  <van-button  type="default" v-for="button in buttons" :key="button.id" :class="{'highlighted': highlightedButtonId === button.id}"
      @click="highlightButton(button.id)">{{ button.label }}</van-button>
</van-space>
<p>{{ currentDate}} 成立以来收益率 2.5%</p>
<img src="./assets/七日年化收益率曲线组合.svg" alt="请找lzb进行调试">
  </van-tab>
  <van-tab >
    <template #title>单位净值 <van-icon name="question-o" /></template>
    <van-space  size="1rem">
      <van-button  type="default" v-for="button in buttons" :key="button.id" :class="{'highlighted': highlightedButtonId === button.id}"
      @click="highlightButton(button.id)">{{ button.label }}</van-button>
  </van-space>
     <p>{{ currentDate}} 单位净值 1.916</p>
     <img src="./assets/单位净值.svg" alt="请找lzb进行调试">
  </van-tab>
</van-tabs>
</div>

<!-- 产品特点 -->
<div class="product-features">
  <div class="clearfix">
    <span class="big-title">产品特点·</span>
    <span class="product-description">金牌理财经理点评</span>
  </div>
  <div class="barrage">
    <!-- <van-barrage v-model="list" :top="25" >
     <div class="video" style="width: 90%; height: 180px">
     </div>
    </van-barrage> -->

    <div class="barrage1">
    <img src="./assets/弹幕1.svg" alt="请找lzb进行调试" class="barrage-img">
    <img src="./assets/弹幕2.svg" alt="请找lzb进行调试" class="barrage-img"> 
    <img src="./assets/弹幕3.svg" alt="请找lzb进行调试" class="barrage-img">
    <img src="./assets/弹幕4.svg" alt="请找lzb进行调试" class="barrage-img">
    </div>
  </div>
  </div>
 

 <!-- 底部 -->
<div class="footer">
    <h3>产品说明书</h3>
    <router-link to="/load">
    <div class="detail"><h5>宁波通商银行“通银丰利”系列安心成长理财（周周赢）个人理财计划 产品说明书</h5></div>
  </router-link>
  </div>
  <!-- 凑高度 -->
  <div class="height-fix"></div>
</div>
</template>

<script setup>
import { ref, onMounted, onUnmounted} from 'vue';
// 气泡

// 按钮
const buttons = ref([
  { id: 1, label: '近一月' },
  { id: 2, label: '近三月' },
  { id: 3, label: '近六月' },
  { id: 4, label: '近一年' },
]);
const highlightedButtonId = ref(null);
function highlightButton(id) {
  highlightedButtonId.value = id;
}

// 弹幕
// const defaultList = [
//       { id: 100, text: '<img src="./assets/弹幕1.svg" alt="请找lzb进行调试">' },
//       { id: 101, text: '<img src="./assets/弹幕1.svg" alt="请找lzb进行调试">'  },
//       { id: 102, text: '<img src="./assets/弹幕1.svg" alt="请找lzb进行调试">' },
//       { id: 103, text: '<img src="./assets/弹幕1.svg" alt="请找lzb进行调试">'  }
//     ];

// const list = ref([...defaultList]);
// const addbarrage = () => {
//       list.value.push({id:'100',text:'焦经理:门槛低，轻松起投'});
//       list.value.push({id:'101',text:'谭经理:风险可控，收益稳健'});
//       list.value.push({id:'102',text:'贾经理:专业团队，贴心服务'});
//       list.value.push({id:'103',text:'史经理:适合稳健理财人群，财富保值需要者'});
//     };
//     let intervalId;
//     onMounted(() => {
//       intervalId = setInterval(addbarrage, 4000); 
//     });
//     onUnmounted(() => {
//       clearInterval(intervalId);
//     });

const currentDate = ref(new Date().toLocaleDateString());


</script>

<style scoped>
header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  /* padding-bottom: 16px; */
}

h1 {
  padding: 0 20px;
  font-size: 20px;
  /* font-weight: bold; */
  color: #444;
}

.back-button {
  position: absolute;
  left: 5px;
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
}

.more-button {
  position: absolute;
  right: 5px;
  font-size: 24px;
  background: none;
  border: none;
  cursor: pointer;
}

.box{
  height: 100%;
  /* lzb认为好看 */
  /* background-image: url('../lzb/assets/背景图.svg'); */
  /* tkc认为好看 */
  background-image: url('./assets/背景图.svg'); 
}
.top{
    height: 30px;
    position: relative;
   
}
.top .van-icon-arrow-left{
    position: absolute;
    top: 50%;
    left: 5%;
    transform: translate(-50%, -50%);

}
.top .van-icon-ellipsis{
    position: absolute;
    top: 50%;
    right: 3%;
    transform: translate(-50%, -50%);

} 
.top .text{
  position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
}
/* 气泡 */
.container1 {
  margin: 10px;
  margin-top: 2px;
  position: relative;
  min-height: 300px;
  padding: 10px;
  background-image:url('./assets/周周赢.svg');
  background-size: cover; /* 使图片覆盖整个 div */
  background-position: center; /* 居中对齐图片 */
  background-repeat: no-repeat; /* 避免图片重复 */
  border-radius: 20px;
}
.bubbles {
	position: absolute;
	width: 95%;
	height: 95%;
	top: 0;
	left: 0;
	overflow: hidden;
}

.bubble {
	position: absolute;
	/* border-radius: 80%;
	bottom: 0;
	background-color: white; */
	/* opacity: 0.8; */
	animation: flying 10s infinite ease-in;
  background-image: url('./assets/开放式泡泡背景.svg');
  background-size: cover; /* 使图片覆盖整个 div */
  background-position: center; /* 居中对齐图片 */
  background-repeat: no-repeat; /* 避免图片重复 */

}

.bubble p{
  font-size: bolder;
  color: black;
}
.bubble .percent{
  color: red;
}

.bubble:nth-child(1) {
	width: 100px;
	height: 85px;
	left: 10%;
	bottom: -30px;
	animation-duration: 10s;
}

.bubble:nth-child(2) {
	width: 90px;
	height: 75px;
	left: 30%;
	bottom: -40px;
	animation-duration: 10s;
	animation-delay: 1s
}

.bubble:nth-child(3) {
	width: 80px;
	height: 65px;
	left: 40%;
	bottom: -17px;
	animation-duration: 9s;
}

.bubble:nth-child(4) {
	width: 90px;
	height: 75px;
	left: 50%;
	bottom: -15px;
	animation-duration: 9s;
	animation-delay: 2s
}

.bubble:nth-child(5) {
	width: 80px;
	height: 65px;
	left: 60%;
	bottom: -18px;
	animation-duration: 10s;
	animation-delay: 2s
}

.bubble:nth-child(6) {
	width: 80px;
	height: 65px;
	left: 70%;
	bottom: -40px;
	animation-duration: 8s;
	animation-delay: 3s
}

.bubble:nth-child(7) {
	width: 80px;
	height: 65px;
	left: 85%;
	bottom: -30px;
	animation-duration: 10s;
	animation-delay: 4s;
}

@keyframes flying {
	0% {
		transform: translateX(0);
	}

	30% {
		transform: translateX(100px);
	} 

	60% {
		transform: translateX(-50px);
	}

	90% {
		bottom: 180px;
		transform: translateX(0);
	} 
}


 /* 破图 */
 .van-button{
  margin-top: 10px;
  height: 25px;
  border-radius: 12%;
  box-shadow: 2px 2px 2px rgba(0,0,0,0.1);
 }
 .highlighted {
  background-color: orange; /* 或其他高亮颜色 */
}
 .chart-container p{
  color: gray;
 }
 .chart-container img{
  width: 100%;
  height: auto;
 }

 /* 产品特点 */
 .product-features {
  margin-top: 10px;
        }
.clearfix::after {
  content: "";
  display: table;
  clear: both;
  }
.big-title{
  float: left;
  font-size: 20px;
  font-weight: bold;
  color: #3d3d3d;
  margin-left: 20px;
}
.product-description {
            float: left; 
            font-size: 13px;
            font-weight: normal;
            color: #b5b5b5;
            margin-left: 10px;
            margin-top: 5px;
        }
.barrage {
  margin: 2px;
  background-image: url('./assets/产品特点背景图.svg');
  background-size: contain; /* 使图片覆盖整个 div */
  background-position: center; /* 居中对齐图片 */
  background-repeat: no-repeat; /* 避免图片重复 */
}
.barrage1{
  position: relative;
  width: 95%;
	height: 200px;
	overflow: hidden;
	
}
.barrage-img{
  position: absolute;
  top: 30%;
  transform: translateY(-50%); 
  animation: barrage-animation 10s linear infinite;
}

.barrage-img:nth-child(1) {
  left: 90%;
  animation-delay: 0s;
}

.barrage-img:nth-child(2) {
  left: 100%;
  animation-delay: 3.5s;
}

.barrage-img:nth-child(3) {
  left: 100%;
  top: 45%;
  animation-delay: 5s;
}

.barrage-img:nth-child(4) {
  left: 100%;
  top: 60%;
  animation-delay: 8s;
}

@keyframes barrage-animation {
   0%{
     left:100%;
   }
   100%{
     left:-100%;
   }
}
/* 底部 */
.footer{
  margin: 10px;
}
.footer h3{
  margin-left: 16px;
  font-size: 20px;
  text-align: left; /* 明确指定左对齐 */
}
.footer .detail{
  background-image: url('./assets/产品详情模块.svg');
  height: 300px;
  background-size: contain; /* 使背景图覆盖整个 div */
  background-position: center; /* 背景图居中 */
  background-repeat: no-repeat; /* 避免图片重复 */
  margin-top: -30px;
}
.footer h5{
  padding-top: 12%;
  font-size: 14px;
  padding-left: 20px;
  padding-right: 20px;
}
.height-fix{
  height: 5px;
}
</style>